package com.training.java.core.collections.car.post15;

public class Car implements Comparable<Car> {
	
	private String make;
	private String model;
	private int year;
	private int price;
	
	public Car(String make, String model, int year, int price)
	{
		this.make = make;
		this.model = model;
		this.year = year;
		this.price = price;
	}

	public String getMake() {
		return make;
	}

	public String getModel() {
		return model;
	}

	public int getYear() {
		return year;
	}

	public int getPrice() {
		return price;
	}
    
	@Override
	public boolean equals(Object obj) {
		
		Car that = (Car) obj;
		if(this.getMake().equals(that.getMake()) && this.getModel().equals(that.getModel()))
		   return true;
		else
			return false;
	}
	
	@Override
	public int hashCode() {
		
		return this.getMake().hashCode();
	}

	@Override
	public int compareTo(Car that) {
		return this.make.compareTo(that.make);
		
	}
}
